/* 
 * File:   ThreadRldEvent.h
 * Author: batista
 *
 * Created on 7 de Março de 2013, 11:56
 */

#ifndef THREADRLDEVENT_H
#define	THREADRLDEVENT_H
#include <vector>
#include <cstring>
#include <string>
#include <iostream>
#include <ucommon/ucommon.h>
//
#include "TimeUtil.h"
#include "DirFile.h"
#include "ShowMsg.h"
#include "Event.h"
#include "SerialPorts.h"
#include "DbConn.h"

using namespace UCOMMON_NAMESPACE;

using namespace std;
using std::string;
class ThreadRldEvent : private ShowMsg, public JoinableThread {
public:
    ThreadRldEvent();
    virtual ~ThreadRldEvent();
    SerialPorts *m_port;
    //
    void run(void);
    //

    DbConn* getDbcon() const {
        return dbcon;
    }

    void setDbcon(DbConn* dbcon) {
        this->dbcon = dbcon;
    }

    DirFile* getDirfl() const {
        return dirfl;
    }

    void setDirfl(DirFile* dirfl) {
        this->dirfl = dirfl;
    }

    //    
private:
    bool RunRldEventCap();
    bool PrepareRldEvent();
    bool EndReadPager();
    void startPort();
    //
    TimeUtil *timet;
    DirFile *dirfl;
    Event *event;
    DbConn *dbcon;
    //
};

#endif	/* THREADRLDEVENT_H */

